<template>
<!-- v-on:input="$emit('input', $event.target.value)" -->
    <input type="text" :value="value"  v-on="listeners" >
</template>

<script>
export default {
    name:"Add",
    props: {
        value: {
            type: String,
            default: '',
        }
    },
    computed: {
        listeners () {
            //event什么时候定义的？
             console.log(event)
            return {
                // Pass all component listeners directly to input ,不止需要一个input事件，还需要按下回车事件
                ...this.$listeners,
                // Override input listener to work with v-model ，只覆盖input事件
                input: event => this.$emit('input', event.target.value)
            }
        }
    }
}
</script>

<style scoped>
   input[type='text']{
       border:1px solid black;
       width:400px;
       line-height: 40px;
       padding-left: 20px;
       font-size: 16px;
       display: block;
       margin: 0 auto;
   }
</style>